var e = require("../../../@babel/runtime/helpers/objectSpread2"), t = require("../utils.js"), a = function(e, a, r) {
    var i = {};
    return e.forEach(function(e) {
        t.isUndefined(r[e]) ? t.isUndefined(a[e]) || (i[e] = a[e]) : i[e] = r[e];
    }), i;
};

exports.mergeConfig = function(r) {
    var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n = i.method || r.method || "GET", o = {
        baseURL: i.baseURL || r.baseURL || "",
        method: n,
        url: i.url || "",
        params: i.params || {},
        custom: e(e({}, r.custom || {}), i.custom || {}),
        header: t.deepMerge(r.header || {}, i.header || {})
    };
    if (o = e(e({}, o), a([ "getTask", "validateStatus", "paramsSerializer", "forcedJSONParsing" ], r, i)), 
    "DOWNLOAD" === n) {
        var d = [ "timeout", "filePath" ];
        o = e(e({}, o), a(d, r, i));
    } else if ("UPLOAD" === n) delete o.header["content-type"], delete o.header["Content-Type"], 
    [ "filePath", "name", "timeout", "formData" ].forEach(function(e) {
        t.isUndefined(i[e]) || (o[e] = i[e]);
    }), t.isUndefined(o.timeout) && !t.isUndefined(r.timeout) && (o.timeout = r.timeout); else {
        var s = [ "data", "timeout", "dataType", "responseType", "enableHttp2", "enableQuic", "enableCache", "enableHttpDNS", "httpDNSServiceId", "enableChunked", "forceCellularNetwork" ];
        o = e(e({}, o), a(s, r, i));
    }
    return o;
};